import Cookies from 'js-cookie'

export function getName () {
  return Cookies.get('name')
}

export function setName (name) {
  return Cookies.set('name', name)
}

export function getIntroduction () {
  return Cookies.get('introduction')
}

export function setIntroduction (introduction) {
  return Cookies.set('introduction', introduction)
}

export function getRoles () {
  let data = Cookies.get('roles')
  if (data) {
    return [data]
  } else {
    return null
  }
}

export function setRoles (roles) {
  return Cookies.set('roles', roles)
}

export function removeAuth () {
  Cookies.remove('name')
  Cookies.remove('introduction')
  Cookies.remove('roles')
}
